package org.ch02.test00.demo05;

import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Scanner;

/**
 * @author ZQX
 * @date 2025-03-19
 */
public class MainTest {
    public static void main(String[] args) throws Exception {
        Constructor<Scanner> constructor = Scanner.class.getConstructor(InputStream.class);
        Scanner scanner = constructor.newInstance(System.in);

        System.out.print("请输入邮箱:");
        String email = scanner.next();

        Class<Email> emailClass = Email.class;
        Method getEmail = emailClass.getDeclaredMethod("getEmail03", String.class);
        getEmail.setAccessible(true);
        String invoke = (String) getEmail.invoke(null, email);
        System.out.println("账户名:" + invoke);
    }
}
